package main

import (
	_ "GinHelloWorld/db"
	"GinHelloWorld/routers"
	"github.com/gin-gonic/gin"
	"github.com/gin-gonic/gin/binding"
	"github.com/go-playground/validator/v10"
)

func main() {
	r := gin.Default()

	//注册验证
	if _, ok := binding.Validator.Engine().(*validator.Validate); ok {
		//绑定第一个参数是验证的函数第二个参数是自定义的验证函数
		//v.RegisterValidation("nameCheck", CheckName)
	}

	//启动路由
	routers.CollectRoutes(r)
	//在9090端口启动服务
	err := r.Run()
	if err != nil {
		panic(err)
	}
}
